package org.zfes.snowier.zbss.xzy.router.zmd;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.zfes.snowier.core.data.DataSet;
import org.zfes.snowier.web.controller.BaseController;
import org.zfes.snowier.zbss.xzy.biz.zmd.model.ModataDevice;
import org.zfes.snowier.zbss.xzy.biz.zmd.service.IModataDeviceService;
import org.zfes.snowier.core.data.SelectVo;
@Controller 
@RequestMapping("/xzy")
public class ModataDeviceController implements BaseController {

	
	@Autowired
	private IModataDeviceService modataDeviceService;
	
	//@RequiresPermissions(value="modataDevice:loadModataDeviceDataSet",desc="监控设备列表")
    @RequestMapping(value="/loadModataDeviceDataSet", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataDeviceDataSet(@RequestBody Map<String,Object> params){
	    DataSet dataSet=  modataDeviceService.loadModataDeviceDataSet(params);
	    return ajaxQuery("dataSet", dataSet);
    }
	
	//@RequiresPermissions(value="modataDevice:createModataDevice",desc="监控设备添加")
    @RequestMapping(value="/createModataDevice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public  @ResponseBody Object createModataDevice(@RequestBody ModataDevice modataDevice){
		modataDeviceService.createModataDevice(modataDevice);
    	return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataDevice:loadModataDevice",desc="监控设备加载")
    @RequestMapping(value="/loadModataDevice/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataDevice(@PathVariable("id")Long id){
		Optional<ModataDevice> ops = modataDeviceService.loadModataDeviceById(id);
		return ajaxQuery("modataDevice",ops);
    }
	
	//@RequiresPermissions(value="modataDevice:updateModataDevice",desc="监控设备更新")
    @RequestMapping(value="/updateModataDevice", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object updateModataDevice(@RequestBody  ModataDevice modataDevice){
		modataDeviceService.updateModataDevice(modataDevice);
		return ajaxDoneSuccess("数据操作成功 ");
    }
	
	//@RequiresPermissions(value="modataDevice:deletModataDevice",desc="监控设备删除")
    @RequestMapping(value="/deleteModataDevice/{id}", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object deleteModataDevice(@PathVariable("id")Long id){
		modataDeviceService.deleteModataDevice(id);
		return ajaxDoneSuccess("数据操作成功 ");
    }


    @RequestMapping(value="/loadModataDeviceSelectVo", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
    public @ResponseBody  Object loadModataDeviceSelectVo(){
		 List<SelectVo>  ops = modataDeviceService.loadModataDeviceSelectVo("");
		return ajaxQuery("selectVo",ops);
    }
    
}